package d1208.Ljs2.Ljs6;

import org.apache.commons.io.FileUtils;

import java.io.File;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.List;

public class Demo1 {
    public static void main(String[] args) throws IOException, ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
        Class<?>clazz=Class.forName("Ljs2.Ljs6.Person");
        Constructor<?> constructor = clazz.getConstructor(String.class,String.class,int.class);


        List<String>list=FileUtils.readLines(new File("Ljs2/Ljs6/data2.txt"));
        for (int i = 0; i < list.size(); i++) {
            String[] arr = list.get(i).split("=");
            Object o = constructor.newInstance(arr[0],arr[1],Integer.parseInt(arr[2]));
        }
    }
}
